<?php
include '../../auth/ceklogin.php';
include '../../sql/conn.php';
$id=$_REQUEST['id'];
$barcode=$_REQUEST['barcode'];
$namaBarang=$_REQUEST['namaBarang'];
$idKategoriBarang=$_REQUEST['idKategoriBarang'];
$idSatuanBarang=$_REQUEST['idSatuanBarang'];
$jumBarang=$_REQUEST['jumBarang'];
$hargaJual=$_REQUEST['hargaJual'];
$idSupplier=$_REQUEST['idSupplier'];

$query=mysql_query("
UPDATE
        `bukakainti`.`barang` 
SET  
        `barcode` = '$barcode',
        `namaBarang` = '$namaBarang',
        `idKategoriBarang` = '$idKategoriBarang',
        `idSatuanBarang` = '$idSatuanBarang',
        `jumBarang` = '$jumBarang',
        `hargaJual` = '$hargaJual',
        `idSupplier` = '$idSupplier',
        `username` =  '$_SESSION[userbkknt]',
        `last_update` =  now()
WHERE 
        `barang`.`idBarang` ='$id' 
LIMIT 1
");
if($query){
    echo json_encode(array('success'=>true,'msg'=>'Barang dengan Part Number : '.$barcode.' successfully updated.'));
} else {
    echo json_encode(array('msg'=>'Error Occured. '.  mysql_error()));
}
?>